TITLE input6_2.asc: UAV Navigation with line guidance 
// Input for Lab6, line guidance 
OPTIONS y_scrn n_comscrn y_events n_tabout y_plot y_traj n_merge y_doc 
MODULES
	environment		def,init,exec
	aerodynamics	def,exec	
	propulsion		def,init,exec	
	forces			def,exec	
	newton			def,init,exec	
	guidance		def,exec
	control			def,exec	
	intercept		def,exec
END
TIMING
	scrn_step 50
	plot_step 0.2
	traj_step 0.5
	int_step 0.05
	com_step 40
END
VEHICLES 1
	CRUISE3 UAV
		//Initial conditions
			lonx  14.7    //Vehicle longitude - deg  module newton
			latx  35.4    //Vehicle latitude - deg  module newton
			alt  5000    //Vehicle altitude - m  module newton
			psivgx  90    //Vehicle heading angle - deg  module newton
			thtvgx  0    //Vehicle flight path angle - deg  module newton
			dvbe  224    //Vehicle speed - m/s  module newton
			alphax  5    //Angle of attack - deg  module control
			phimvx  0.0    //Bank angle - deg  module control
		//Aerodynamics
			AERO_DECK cruise3_aero_deck.asc
		//Mass properties and propulsion
			mprop  4    //'int' Mode switch - ND  module propulsion
			mach_com  0.7    //Commanded Mach number - ND  module propulsion
			mass_init  1000    //Initial vehicle mass - kg  module propulsion
			fuel_init  150    //Initial fuel - kg  module propulsion
			gfthm  893620    //Gain of Mach hold loop - N  module propulsion
			tfth  1    //Time constant of Mach hold loop - s  module propulsion
			PROP_DECK cruise3_prop_deck.asc
		//loadfactor controller
			anposlimx  3    //Positive load factor limiter - g's  module control
			anneglimx  -1    //Negative load factor limiter - g's  module control
			gacp  10    //Root locus gain of accel loop - rad/s^2  module control
			ta  0.8    //Ratio of prop/integral gains. If>0, P-I engaged  module control
			alpposlimx  15    //Angle of attack positive limiter - deg  module control
			alpneglimx  -10    //Angle of attack negative limiter - deg  module control
		//lateral acceleration controller
			gcp  2    //Lateral roll gain - rad  module control
			allimx  1    //Lateral acceleration limiter - g's  module control
		//bank-angle controller
			philimx  70    //Bank angle command limiter - deg  module control
			tphi  0.5    //Time constant of bank angle response - sec  module control
		//altitude controller
			altdlim  50    //Altitude rate limiter - m/s  module control
			gh  0.3    //Altitude gain - g/m  module control
			gv  1.0    //Altitude rate gain - g/(m/s)  module control
		//heading controller
			psivgcx  90    //Commanded heading angle - deg  module control
			gain_psivg  12.0    //Heading angle hold control gain - ND  module control
		//# Towards waypoint #1
			wp_lonx  14.9    //Longitude of way point - deg  module guidance
			wp_latx  35.4    //Latitude of way point - deg  module guidance
			mguidance  30    //'int' Switch for guidance options - ND  module guidance
			line_gain  1    //Line guidance gain - 1/s  module guidance
			nl_gain_fact  0.6    //Nonlinear gain factor - ND  module guidance
			decrement  1000    //distance decrement - m  module guidance
			psifgx  90    //Heading line-of-attack angle - deg  module guidance
			mcontrol  46    //'int' Mode switch - ND  module control
			altcom  5000    //Altitude command  - m  module control
			IF   wp_flag = -1
			//# Towards waypoint #2 
				wp_lonx  15.25    //Longitude of way point - deg  module guidance
				wp_latx  35.54    //Latitude of way point - deg  module guidance
				psifgx  90    //Heading line-of-attack angle - deg  module guidance
			ENDIF
			IF   wp_flag = -1
			//# Towards waypoint #3
				wp_lonx  15.43    //Longitude of way point - deg  module guidance
				wp_latx  35.44    //Latitude of way point - deg  module guidance
				psifgx  180    //Heading line-of-attack angle - deg  module guidance
			ENDIF
			IF   wp_flag = -1
			//# After waypoint #3, hold heading at 180 deg
				mguidance  0    //'int' Switch for guidance options - ND  module guidance
				mcontrol  16    //'int' Mode switch - ND  module control
			//heading controller
				psivgcx  180    //Commanded heading angle - deg  module control
				gain_psivg  12.0    //Heading angle hold control gain - ND  module control
			ENDIF
	END
END
ENDTIME 480
STOP
